
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
About graphs </TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="pbugp224.htm">Previous</A>&nbsp;&nbsp;<A HREF="pbugp226.htm" >Next</A>
<!-- End Header -->
<A NAME="X-REF299517487"></A><h1>About graphs </h1>
<A NAME="TI7578"></A><p>Often the best way to display information is graphically.
Instead of showing users a series of rows and columns of data, you
can present information as a graph in a DataWindow object or window. For
example, in a sales application, you might want to present summary
information in a column graph.</p>
<A NAME="TI7579"></A><p>PowerBuilder provides many types of graphs and allows you to
customize your graphs in many ways. Probably
most of your use of graphs will be in a DataWindow object. The source of
the data for your graphs will be the database.</p>
<A NAME="TI7580"></A><p>You can also use graphs as standalone controls in windows
(and user objects) and populate the graphs with data through scripts.</p>
<A NAME="TI7581"></A><p>The way you define graphs is the same whether you are using
them in a DataWindow object or directly in a window. However, the way you manipulate
graphs in a DataWindow object is different from the way you manipulate
them in a window.</p>
<A NAME="TI7582"></A><p>Before using graphs in an application, you need to understand
the parts of a graph and the kinds of graphs that PowerBuilder provides.</p>
<A NAME="TI7583"></A><h2>Parts of a graph</h2>
<A NAME="TI7584"></A><p>Here is a column graph created in PowerBuilder that contains
most major parts of a graph. It shows quarterly sales of three products:
Stellar, Cosmic, and Galactic printers:</p>
<br><img src="images/graph02.gif">
<A NAME="TI7585"></A><h3>How data is represented</h3>
<A NAME="TI7586"></A><p>Graphs display data points. To define graphs, you need to
know how the data is represented. PowerBuilder organizes data into
three components.</p>
<A NAME="TI7587"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 26-1: Components of a graph</caption>
<tr><th  rowspan="1"  ><A NAME="TI7588"></A>Component</th>
<th  rowspan="1"  ><A NAME="TI7589"></A>Meaning</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7590"></A>Series</td>
<td  rowspan="1"  ><p><b>A set of data points</b>   Each set of related data points makes up one series. In the
preceding graph, there is a series for Stellar sales, another series
for Cosmic sales, and another series for Galactic sales. Each series
in a graph is distinguished by color, pattern, or symbol.</p>
</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7591"></A>Categories</td>
<td  rowspan="1"  ><p><b>The major divisions of the
data</b>   Series data are divided into categories, which are often non-numeric.
In the preceding graph, the series are divided into four categories:
Q1, Q2, Q3, and Q4. Categories represent values of the independent
variable(s).</p>
</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7592"></A>Values</td>
<td  rowspan="1"  ><A NAME="TI7593"></A>The values for the data points (dependent
variables).</td>
</tr>
</table>
<A NAME="TI7594"></A><h3>Organization of a graph</h3>
<A NAME="TI7595"></A><p><A HREF="pbugp225.htm#CEGFGACD">Table 26-2</A> lists
the parts of a typical graph.</p>
<A NAME="CEGFGACD"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 26-2: Organization of a graph</caption>
<tr><th  rowspan="1"  ><A NAME="TI7596"></A>Part of graph</th>
<th  rowspan="1"  ><A NAME="TI7597"></A>What it is</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7598"></A>Title</td>
<td  rowspan="1"  ><A NAME="TI7599"></A>An optional title for the graph. The
title appears at the top of the graph.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7600"></A>Value axis</td>
<td  rowspan="1"  ><A NAME="TI7601"></A>The axis of the graph along which the
values of the dependent variable(s) are plotted. In a column graph,
as shown in the preceding graph, the Value axis corresponds to the
y axis in an XY presentation. In other types of graphs, such as
a bar graph, the Value axis can be along the x dimension.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7602"></A>Category axis</td>
<td  rowspan="1"  ><A NAME="TI7603"></A>The axis along which are plotted the
major divisions of the data, representing the independent variable(s).
In the preceding graph, the Category axis corresponds to the x axis.
It plots four categories: Q1, Q2, Q3, and Q4. These form the major
divisions of data in the graph.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7604"></A>Series</td>
<td  rowspan="1"  ><A NAME="TI7605"></A>A set of data points. There are three
series in the preceding graph: Stellar, Cosmic, and Galactic. In
bar and column charts, each series is represented by bars or columns
of one color or pattern.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7606"></A>Series axis</td>
<td  rowspan="1"  ><A NAME="TI7607"></A>The axis along which the series are plotted
in three-dimensional (3D) graphs.</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7608"></A>Legend</td>
<td  rowspan="1"  ><A NAME="TI7609"></A>An optional listing of the series. The
preceding graph contains a legend that shows how each series is
represented in the graph.</td>
</tr>
</table>
<A NAME="TI7610"></A><h2>Types of graphs</h2>
<A NAME="TI7611"></A><p>PowerBuilder provides many types of graphs for you to choose
from. You choose the type on the Define Graph Style page in the DataWindow wizard
or in the General page in the Properties view for the graph.</p>
<br><img src="images/graph03.gif">
<A NAME="TI7612"></A><h3>Area, bar, column, and line graphs</h3>
<A NAME="TI7613"></A><p>Area, bar, column, and line graphs are conceptually very similar.
They differ only in how they physically represent the data values&#8212;whether
they use areas, bars, columns, or lines to represent the values.
All other properties are the same. Typically you use area and line
graphs to display continuous data and use bar and column graphs
to display noncontinuous data.</p>
<A NAME="TI7614"></A><p>The only difference between a bar graph and a column graph
is the orientation: in column graphs, values are plotted along the
y axis and categories are plotted along the x axis. In bar graphs,
values are plotted along the x axis and categories are plotted along
the y axis.</p>
<A NAME="TI7615"></A><h3>Pie graphs</h3>
<A NAME="TI7616"></A><p>Pie graphs typically show one series of data points with each
data point shown as a percentage of a whole. The following pie graph
shows the sales for Stellar printers for each quarter. You can easily
see the relative values in each quarter. (PowerBuilder automatically
calculates the percentages of each slice of the pie.)</p>
<br><img src="images/graph23.gif">
<A NAME="TI7617"></A><p>You can have pie graphs with more than one series if you want;
the series are shown in concentric circles. Multiseries pie graphs
can be useful in comparing series of data.</p>
<A NAME="TI7618"></A><h3>Scatter graphs</h3>
<A NAME="TI7619"></A><p>Scatter graphs show xy data points. Typically you use scatter
graphs to show the relationship between two sets of numeric values. Non-numeric values, such as string
and DateTime datatypes, do not display correctly.</p>
<A NAME="TI7620"></A><p>Scatter graphs do not use categories. Instead, numeric values
are plotted along both axes&#8212;as opposed to other graphs,
which have values along one axis and categories along the other
axis.</p>
<A NAME="TI7621"></A><p>For example, the following data shows the effect of speed
on the mileage of a sedan:</p>
<A NAME="TI7622"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><tr><th  rowspan="1"  ><A NAME="TI7623"></A>Speed</th>
<th  rowspan="1"  ><A NAME="TI7624"></A>Mileage</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7625"></A>10</td>
<td  rowspan="1"  ><A NAME="TI7626"></A>12</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7627"></A>20</td>
<td  rowspan="1"  ><A NAME="TI7628"></A>18</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7629"></A>30</td>
<td  rowspan="1"  ><A NAME="TI7630"></A>21</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7631"></A>40</td>
<td  rowspan="1"  ><A NAME="TI7632"></A>23</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7633"></A>50</td>
<td  rowspan="1"  ><A NAME="TI7634"></A>26</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7635"></A>60</td>
<td  rowspan="1"  ><A NAME="TI7636"></A>26</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7637"></A>70</td>
<td  rowspan="1"  ><A NAME="TI7638"></A>24</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7639"></A>80</td>
<td  rowspan="1"  ><A NAME="TI7640"></A>20</td>
</tr>
</table>
<A NAME="TI7641"></A><p>Here is the data in a scatter graph:</p>
<br><img src="images/graph09.gif">
<A NAME="TI7642"></A><p>You can have multiple series of data in a scatter graph. You
might want to plot mileage versus speed for several makes of cars
in the same graph.</p>
<A NAME="TI7643"></A><h3>Three-dimensional graphs</h3>
<A NAME="TI7644"></A><h4>Traditional 3D graphs</h4>
<A NAME="TI7645"></A><p>You can also create 3-dimensional (3D) graphs of area, bar,
column, line, and pie graphs. In 3D graphs (except for 3D pie graphs),
series are plotted along a third axis (the Series axis) instead
of along the Category axis. You can specify the perspective to use
to show the third dimension:</p>
<br><img src="images/graph11.gif">
<A NAME="TI7646"></A><h4>DirectX 3D graphs</h4>
<A NAME="TI7647"></A><p>DirectX 3D rendering allows you to display the 3D graphs (Pie3D,
Bar3D, Column3D, Line3D, and Area3D) with a more sophisticated look.
You can use data item or series transparency with the DirectX graph
styles to improve the presentation of data. </p>
<A NAME="TI7648"></A><p>The DirectX graph rendering style is supported for standalone
graph controls and for graph controls in a DataWindow object. PowerBuilder
uses the following functions to support the DirectX graph styles:</p>
<A NAME="TI7649"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><tr><td  rowspan="1"  ><A NAME="TI7650"></A>GetDataLabelling</td>
<td  rowspan="1"  ><A NAME="TI7651"></A>SetDataLabelling</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7652"></A>GetDataTransparency</td>
<td  rowspan="1"  ><A NAME="TI7653"></A>SetDataTransparency</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7654"></A>GetSeriesLabelling</td>
<td  rowspan="1"  ><A NAME="TI7655"></A>SetSeriesLabelling</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI7656"></A>GetSeriesTransparency</td>
<td  rowspan="1"  ><A NAME="TI7657"></A>SetSeriesTransparency</td>
</tr>
</table>
<p><b>DirectX runtime</b>   The DirectX 3D rendering depends on the DirectX runtime. The
first time you select the Render3D check box on the General tab
of the Properties view for a 3D graph, PowerBuilder launches the
DirectX installer. If you opt out of the installation, the Render3D
property is ignored. End users of PowerBuilder applications must
also have the DirectX runtime installed on their computers.</p>
<A NAME="TI7658"></A><p>If you install DirectX on the runtime computer, but selecting
the Render3D check box does not change the appearance of the graph,
it is possible that the graphics card does not support DirectX.</p>
<A NAME="TI7659"></A><p>You can check whether DirectX is supported by running <i>dxdiag.exe</i>.
This file is typically installed in the <i>Windows\System32</i> directory.
The Display tab of the DirectX Diagnostic Tool that opens when you
run <i>dxdiag.exe</i> indicates whether Direct3D is
enabled.</p>
<A NAME="TI7660"></A><h3>Stacked graphs</h3>
<A NAME="TI7661"></A><p>In bar and column graphs, you can choose to stack the bars
and columns. In stacked graphs, each category is represented as
one bar or column instead of as separate bars or columns for each
series:</p>
<br><img src="images/graph12.gif">
<A NAME="TI7662"></A><h2>Using graphs in applications</h2>
<A NAME="TI7663"></A><p>You can use graphs in DataWindow objects and in windows. You specify
the properties of a graph, such as its type and title, the same
way in a DataWindow object as in a window.</p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Using graphs in user objects</span> <A NAME="TI7664"></A>You can also use graphs in user objects. Everything in this
chapter about using graphs in windows also applies to using graphs
in user objects.</p>
<A NAME="TI7665"></A><p>The major differences between using a graph in a DataWindow object and using
a graph in a window (or user object) are:<A NAME="TI7666"></A>
<ul>
<li class=fi>Specifying the data for the graph<br>
In DataWindow objects, you associate columns in the database with
the axes of a graph. In windows, you write scripts containing PowerScript functions
to populate a graph.<br></li>
<li class=ds>Specifying the location of the graph<br>
In DataWindow objects, you can place a graph in the foreground and
allow users to move and resize the graph at runtime, or you can
place a graph in a band and prevent movement. In windows, graphs
are placed like all other window controls.<br>
</li>
</ul>
</p>

